<?
require 'global.php';

if($customer_id==0) { echo '8'; exit; }
$gee=$wishlist;

$id=0; if (isset($_GET["id"])) $id = clean($_GET["id"]);
$do='add'; if (isset($_GET["do"])) $do = clean($_GET["do"]);

//echo $pid.'/'.$varid.'/'.$qty.'/'.$do;
//exit;
$k=0;
if($do=='add'){
	$arr=array(
		'product_id'=>$id,
		'customer_id'=>$customer_id,
	);
	// 判断是否已在收藏夹
	$where=array();
	$where[]=array('name'=>'product_id','val'=>$id);
	$where[]=array('name'=>'customer_id','val'=>$customer_id);
	$tem=$gee->get_rows_advanced(1024,$where);
	if(count($tem) > 0) { echo '1'; exit; }
	if($gee->insert($arr)) $k=1;
}
if($do=='delete'){
	$tem=$gee->get_row($id);
	if($tem['customer_id']!=$customer_id) { echo '0'; exit; }
	if($gee->delete($id)) $k=1;
}

echo $k;

?>